<%--
  Created by IntelliJ IDEA.
  User: zhuangjianhui_91
  Date: 2015/8/5
  Time: 13:10
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<html>
<head>
    <title></title>
</head>
<h3>Number Format:</h3>
<c:set var="balance" value="120000.2309"/>
<p>Formatted Number (1): <fmt:formatNumber value="${balance}" type="currency"/></p>

<p>Formatted Number (2): <fmt:formatNumber type="number" maxIntegerDigits="3" value="${balance}"/></p>

<p>Formatted Number (3): <fmt:formatNumber type="number" maxFractionDigits="3" value="${balance}"/></p>

<p>Formatted Number (4): <fmt:formatNumber type="number" groupingUsed="false" value="${balance}"/></p>

<p>Formatted Number (5): <fmt:formatNumber type="percent" maxIntegerDigits="3" value="${balance}"/></p>

<p>Formatted Number (6): <fmt:formatNumber type="percent" minFractionDigits="10" value="${balance}"/></p>

<p>Formatted Number (7): <fmt:formatNumber type="percent" maxIntegerDigits="3" value="${balance}"/></p>

<p>Formatted Number (8): <fmt:formatNumber type="number" pattern="###.###E0" value="${balance}"/></p>

<p>Currency in USA :
    <fmt:setLocale value="en_US"/>
    <fmt:formatNumber value="${balance}" type="currency"/></p>

<h1>=============================时间格式化</h1>
<c:set var="now" value="<%=new java.util.Date()%>"/>

<p>Formatted Date (1): <fmt:formatDate type="time" value="${now}"/></p>

<p>Formatted Date (2): <fmt:formatDate type="date" value="${now}"/></p>

<p>Formatted Date (3): <fmt:formatDate type="both" value="${now}"/></p>

<p>Formatted Date (4): <fmt:formatDate type="both" dateStyle="short" timeStyle="short" value="${now}"/></p>

<p>Formatted Date (5): <fmt:formatDate type="both" dateStyle="medium" timeStyle="medium" value="${now}"/></p>

<p>Formatted Date (6): <fmt:formatDate type="both" dateStyle="long" timeStyle="long" value="${now}"/></p>

<p>Formatted Date (7): <fmt:formatDate pattern="yyyy-MM-dd" value="${now}"/></p>

<h1>============================函数标签</h1>
<c:set var="string1" value="This is first String."/>
<c:set var="string2" value="This <b>is second String.</b>"/>

<p>With escapeXml() Function:</p>

<p>string (1) : ${fn:escapeXml(string1)}</p>

<p>string (2) : ${fn:escapeXml(string2)}</p>

<p>Without escapeXml() Function:</p>

<p>string (1) : ${string1}</p>

<p>string (2) : ${string2}</p>

<c:out value="${pageContext.request.requestURL}"></c:out>

</body>
</html>
